package org.shj.thread.javaconcurrencypattern.twophasetermination;

import org.shj.thread.javaconcurrencypattern.common.AlarmMgr;

public class Main {

	public static void main(String[] args){
		final AlarmMgr mgr = AlarmMgr.getInstance();
		mgr.init();
		
		for(int i = 0 ; i < 100; i++){
			final int cnt = i;
			new Thread(){
				public void run(){
					AlarmType type = (cnt %2 == 0) ? AlarmType.FAULT : AlarmType.RESUME;
					mgr.sendAlarm(type, "Msg" + cnt, "extraInfo Of Msg" + cnt);
				}
			}.start();
		}
		mgr.shutdown();
	}
}
